﻿package 
{
    import Toolbar.*;
    import com.assist.*;
    import com.assist.server.*;
    import com.assist.view.*;
    import com.assist.view.interfaces.*;
    import com.assist.view.interfaces.map.*;
    import com.assist.view.warSoul.*;
    import com.haloer.display.*;
    import com.lang.client_resources.toolbar.*;
    import fl.controls.*;
    import fl.events.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.text.*;
    import flash.utils.*;

    public class Toolbar extends Sprite implements IToolbar
    {
        public var _MiniMap:MCMiniMap;
        public var _FunctionLink:FunctionLink;
        public var _FunctionBar:FunctionBar;
        public var _PlayerData:MovieClip;
        public var _QuestTrace:MovieClip;
        private var _tip:ITip;
        private var _alert:IAlert;
        private var _goodsIconUrl:String;
        private var _addonsUrl:String;
        private var _ingotChange:ChangeColor;
        private var _coinChange:ChangeColor;
        private var soundOpenSign:String = "SoundOpen";
        private var soundMuteSign:String = "SoundMute";
        private var _PlayerDatalist:Array;
        private var _onSoundOpen:Function;
        private var _onSoundMute:Function;
        private var _onPlayerIcon:Function;
        private var _onRecharge:Function;
        private var _onAchievement:Function;
        private var _onBuyPower:Function;
        private var _light:Class;
        private var _video:MovieClip;
        private var _warSoul:WarSoul;
        private var _powerTimer:Timer;
        private var _isShowPower:Boolean = false;
        private var addMcPlayBool:Boolean = false;
        private var _powerFirst:int = 0;
        private var _maxPower:int = 0;
        private var _countPower:int = 0;
        private var _oldPower:int = 0;
        private var _newPower:int = 0;
        private var _increasePower:Boolean = false;
        private var _textAnimation:TextAnimation;
        private var _lastIngot:int = -1;
        private var _lastCoins:Number = -1;
        private var _isShowPlayerInfo:Boolean = false;
        private var _iconFile:TextField;
        private var _iconFrame:TextFormat;
        private var _onPlayerIconOver:Function;
        private var _isIconOver:Boolean = false;
        private var _onOpenRune:Function;
        private var _onDoubleRemoveBuff:Function;
        private var _buff:Buff;
        private var _textFormat:Object;
        private var _intLinkY:int = 0;
        private var _objFunctionLink:Object;
        private var _onLinkTextClick:Function;
        private var _onLinkBtnClick:Function;
        private var _questTraceData:Object;
        private var _questTraceLink:Function;
        private var _questBackHeight:int = 30;
        private var _questAddonHeight:int = 10;
        private var _maxQuestLine:int = 5;
        private var _maxQuestCount:int = 3;
        private var _questScrollBar:UIScrollBar;
        private var _hasQuestScrollBar:Boolean;
        private var _questLines:Array;
        private var _expand:Boolean = true;
        private var _tabType:String = "accepted";
        private var _scrollVs:Object;
        private var _onQuest:Function;
        private var _onEnd:Function;
        private var _onBody:Function;
        private var _onPack:Function;
        private var _onUpgrade:Function;
        private var _onDeploy:Function;
        private var _onResearch:Function;
        private var _onFate:Function;
        private var _onSealSoul:Function;
        private var _onPetAnimal:Function;
        private var _onFriend:Function;
        private var _onFaction:Function;
        private var _onStudyStunt:Function;
        private var _onPractice:Function;
        private var _isFriendMessage:Boolean = false;
        private var _messageCount:int = 0;
        private var _showExpFile:Boolean = false;
        private var _onClickIgnore:Function;
        private var _aryFlowerImg:Array;
        private var _aryFlowerCount:Array;
        private var _blnInFlowerRainPlay:Boolean = false;
        private var _intFlowerRainHeight:int;
        private var _intFlowerRainWidth:int;
        private var _playerDataXY:Array;
        private var _functionLinkXY:Array;
        private var _miniMapXY:Array;
        private var _questTraceXY:Array;
        private var _functionBarXY:Array;
        private var _friendMessageXY:Array;

        public function Toolbar()
        {
            this._PlayerDatalist = ["PlayerIcon", this.soundOpenSign, this.soundMuteSign, "Recharge", "BuyPower"];
            this._onSoundOpen = new Function();
            this._onSoundMute = new Function();
            this._onPlayerIcon = new Function();
            this._onRecharge = new Function();
            this._onAchievement = new Function();
            this._onBuyPower = new Function();
            this._powerTimer = new Timer(0);
            this._onPlayerIconOver = new Function();
            this._onOpenRune = new Function();
            this._onDoubleRemoveBuff = new Function();
            this._textFormat = new TextFormat("", 12);
            this._objFunctionLink = {};
            this._onLinkTextClick = new Function();
            this._onLinkBtnClick = new Function();
            this._questLines = [];
            this._scrollVs = {accepted:1, acceptable:1};
            this._onQuest = new Function();
            this._onEnd = new Function();
            this._onBody = new Function();
            this._onPack = new Function();
            this._onUpgrade = new Function();
            this._onDeploy = new Function();
            this._onResearch = new Function();
            this._onFate = new Function();
            this._onSealSoul = new Function();
            this._onPetAnimal = new Function();
            this._onFriend = new Function();
            this._onFaction = new Function();
            this._onStudyStunt = new Function();
            this._onPractice = new Function();
            this._aryFlowerImg = [];
            this._aryFlowerCount = [10, 45, 45, 20];
            this._playerDataXY = [2, 3];
            this._functionLinkXY = [15, 125];
            this._miniMapXY = [809, 10];
            this._questTraceXY = [805, 123];
            this._functionBarXY = [320, 520];
            this._friendMessageXY = [846, 508];
            this._ingotChange = new ChangeColor();
            this._coinChange = new ChangeColor();
            return;
        }// end function

        public function init() : void
        {
            this.playerData();
            this.buff();
            this.questTrace();
            this.functionBar();
            this.showBarInfo();
            this.clickIgnore();
            this._powerTimer.addEventListener(TimerEvent.TIMER, this.onPowerEvent);
            return;
        }// end function

        private function formatTextFormat(param1:TextField, param2:Boolean) : void
        {
            var _loc_3:* = new TextFormat();
            _loc_3.font = "Tahoma";
            _loc_3.bold = param2;
            param1.setTextFormat(_loc_3);
            return;
        }// end function

        public function clear() : void
        {
            return;
        }// end function

        public function set onSoundControl(param1:Function) : void
        {
            this._onSoundOpen = param1;
            this._onSoundMute = param1;
            return;
        }// end function

        public function set onPlayerIcon(param1:Function) : void
        {
            this._onPlayerIcon = param1;
            return;
        }// end function

        public function set onRecharge(param1:Function) : void
        {
            this._onRecharge = param1;
            return;
        }// end function

        public function set onAchievement(param1:Function) : void
        {
            this._onAchievement = param1;
            return;
        }// end function

        public function set nickName(param1:String) : void
        {
            this._PlayerData._NickName.text = param1;
            this._PlayerData._NickName.setTextFormat(new TextFormat(null, null, null, true));
            return;
        }// end function

        public function set onBuyPower(param1:Function) : void
        {
            this._onBuyPower = param1;
            return;
        }// end function

        public function playAchievementMc() : void
        {
            this.loadFunctionBarEffect();
            return;
        }// end function

        public function loadFunctionBarEffect() : void
        {
            return;
        }// end function

        public function health(param1:int, param2:int) : void
        {
            var _loc_3:* = param1 / param2;
            if (_loc_3 < 0.5)
            {
                this._PlayerData._HpDownMc.visible = true;
            }
            else
            {
                this._PlayerData._HpDownMc.visible = false;
            }
            this.progress("Health", 136, param1, param2, true);
            this.formatTextFormat(this._PlayerData["_Health"], true);
            return;
        }// end function

        public function soundMute(param1:Boolean) : void
        {
            this._MiniMap._SoundMute.visible = param1;
            this._MiniMap._SoundOpen.visible = !param1;
            return;
        }// end function

        public function power(param1:int, param2:int) : void
        {
            this._oldPower = this._newPower;
            this._newPower = param1;
            this._maxPower = param2;
            this._PlayerData._BuyPower.visible = this._isShowPower;
            if (this._powerFirst == 0)
            {
                this._oldPower = this._newPower;
                this._countPower = this._newPower;
                this._powerFirst = 1;
            }
            this._increasePower = this._newPower >= this._oldPower;
            if (this.addMcPlayBool)
            {
                return;
            }
            this.addMcPlayBool = true;
            this._powerTimer.start();
            return;
        }// end function

        public function set powerVisible(param1:Boolean) : void
        {
            this._isShowPower = param1;
            this._PlayerData._BuyPower.visible = param1;
            return;
        }// end function

        public function set powerInfo(param1:Object) : void
        {
            this._tip.addTarget(this._PlayerData._BuyPower, "<font color=\"#f7941d\">" + param1.info + "</font>");
            return;
        }// end function

        public function powerCount() : void
        {
            var _loc_1:* = this._newPower - this._oldPower;
            this._oldPower = this._newPower;
            if (_loc_1 == 0)
            {
                return;
            }
            var _loc_2:* = new TextAnimation();
            _loc_2.color = 16773376;
            _loc_2.bold = true;
            _loc_2.target = this._PlayerData._PowerBtn;
            _loc_2.startAlphaNum = 10;
            _loc_2.speed = -1;
            if (_loc_1 > 0)
            {
                _loc_2.textInfo = "+" + _loc_1 + ToolbarLang.Power;
            }
            else
            {
                _loc_2.textInfo = _loc_1 + ToolbarLang.Power;
            }
            _loc_2.start();
            return;
        }// end function

        private function onPowerEvent(event:TimerEvent) : void
        {
            if (this._oldPower < this._newPower)
            {
            }
            if (this._increasePower == true)
            {
                this._oldPower = this._oldPower + 3;
                if (this._oldPower > this._newPower)
                {
                    this._oldPower = this._newPower;
                }
            }
            else
            {
                if (this._oldPower > this._newPower)
                {
                }
                if (this._increasePower == false)
                {
                    this._oldPower = this._oldPower - 3;
                    if (this._oldPower < this._newPower)
                    {
                        this._oldPower = this._newPower;
                    }
                }
            }
            if (this._oldPower == this._newPower)
            {
                this.addMcPlayBool = false;
                this._powerTimer.stop();
            }
            this.progress("Power", 136, this._oldPower, 200, true);
            return;
        }// end function

        private function progress(param1:String, param2:Number, param3:int, param4:int, param5:Boolean) : void
        {
            param1 = "_" + param1;
            var _loc_6:int = 0;
            if (param3 > param4)
            {
                _loc_6 = param4;
            }
            else
            {
                _loc_6 = param3;
            }
            this._PlayerData[param1 + "Left"].visible = _loc_6 > 0;
            this._PlayerData[param1 + "Middle"].visible = _loc_6 > 0;
            this._PlayerData[param1 + "Right"].visible = _loc_6 > 0;
            param2 = param2 - this._PlayerData[param1 + "Left"].width - this._PlayerData[param1 + "Right"].width;
            this._PlayerData[param1 + "Middle"].width = _loc_6 / param4 * param2;
            this._PlayerData[param1 + "Right"].x = this._PlayerData[param1 + "Middle"].x + this._PlayerData[param1 + "Middle"].width;
            if (param5)
            {
                this._PlayerData[param1].text = param3 + "/" + param4;
            }
            else
            {
                this._PlayerData[param1].text = param3;
            }
            this.formatTextFormat(this._PlayerData[param1], true);
            return;
        }// end function

        public function set level(param1:int) : void
        {
            this._PlayerData._Level.text = param1;
            return;
        }// end function

        public function set ingot(param1:int) : void
        {
            this._tip.addTarget(this._PlayerData._Ingot, ToolbarLang.Ingot + " " + param1);
            if (this._lastIngot == -1)
            {
                this._lastIngot = param1;
            }
            var _loc_2:* = this._lastIngot > param1 ? (16711680) : (65280);
            this._ingotChange.textColorForIngot(this._PlayerData._Ingot, param1, _loc_2, 16773632, 12);
            this._lastIngot = param1;
            return;
        }// end function

        public function set coins(param1:Number) : void
        {
            this._tip.addTarget(this._PlayerData._Coins, ToolbarLang.Coins + " " + param1);
            if (Math.floor(this._lastCoins) == -1)
            {
                this._lastCoins = param1;
            }
            var _loc_2:* = this._lastCoins > param1 ? (16711680) : (65280);
            this._coinChange.textColorForCoins(this._PlayerData._Coins, param1, _loc_2, 16777215, 12);
            this._lastCoins = param1;
            return;
        }// end function

        public function set PlayerInfo(param1:String) : void
        {
            if (param1.length <= 0)
            {
                this._tip.removeTarget(this._PlayerData._PlayerIcon);
                this._isShowPlayerInfo = false;
            }
            else if (this._isShowPlayerInfo == false)
            {
                this._tip.addTarget(this._PlayerData._PlayerIcon, this._iconFile);
                this._isShowPlayerInfo = true;
            }
            this._iconFile.htmlText = param1;
            this._iconFile.setTextFormat(this._iconFrame);
            return;
        }// end function

        public function iconFile() : void
        {
            this._iconFile = new TextField();
            this._iconFile.autoSize = TextFieldAutoSize.LEFT;
            this._iconFrame = new TextFormat();
            this._iconFrame.leading = 8;
            return;
        }// end function

        public function set onPlayerIconOver(param1:Function) : void
        {
            this._onPlayerIconOver = param1;
            return;
        }// end function

        private function playerData() : void
        {
            var _loc_3:String = null;
            var _loc_4:String = null;
            var _loc_5:SimpleButton = null;
            this._PlayerData._NickName.selectable = false;
            this._PlayerData._Health.selectable = false;
            this._PlayerData._Level.selectable = false;
            this._PlayerData._Ingot.selectable = false;
            this._PlayerData._Coins.selectable = false;
            this._PlayerData._Power.selectable = false;
            this._MiniMap._SoundMute.visible = false;
            this._PlayerData._HealthTip.visible = false;
            var _loc_1:* = this._PlayerDatalist.length;
            var _loc_2:uint = 0;
            while (_loc_2 < _loc_1)
            {
                
                _loc_3 = this._PlayerDatalist[_loc_2];
                _loc_4 = "_" + _loc_3;
                if (!this._PlayerData[_loc_4])
                {
                }
                if (!this._MiniMap[_loc_4])
                {
                    throw new Error("名称为：" + _loc_4 + " 的影片剪辑不存在！");
                }
                if (_loc_3 != this.soundOpenSign)
                {
                }
                if (_loc_3 == this.soundMuteSign)
                {
                    _loc_5 = this._MiniMap[_loc_4];
                }
                else
                {
                    _loc_5 = this._PlayerData[_loc_4];
                }
                _loc_5.addEventListener(MouseEvent.CLICK, this.getPlayerDataEventHandler(_loc_2));
                _loc_2 = _loc_2 + 1;
            }
            this._PlayerData._PlayerIcon.addEventListener(MouseEvent.MOUSE_OVER, this.PlayerIconMouserOver);
            this._PlayerData._PlayerIcon.addEventListener(MouseEvent.MOUSE_OUT, this.PlayerIconMouserOut);
            this.iconFile();
            this._tip.addTarget(this._PlayerData._PlayerIcon, this._iconFile);
            this._tip.addTarget(this._MiniMap._SoundOpen, ToolbarLang.SoundOpenTip);
            this._tip.addTarget(this._MiniMap._SoundMute, ToolbarLang.SoundMuteTip);
            this._tip.addTarget(this._PlayerData._Level, ToolbarLang.LevelTip);
            this._tip.addTarget(this._PlayerData._Ingot, ToolbarLang.Ingot);
            this._tip.addTarget(this._PlayerData._Coins, ToolbarLang.Coins);
            this._tip.addTarget(this._PlayerData._HealthBtn, ToolbarLang.HealthTip);
            this._tip.addTarget(this._PlayerData._PowerBtn, ToolbarLang.PowerTip);
            this._tip.addTarget(this._PlayerData._Rune, ToolbarLang.RuneTip);
            this._tip.addTarget(this._QuestTrace._Quest, ToolbarLang.Quest + "[Q]");
            this.runes();
            return;
        }// end function

        private function PlayerIconMouserOver(event:MouseEvent) : void
        {
            if (this._isIconOver == false)
            {
                this._onPlayerIconOver();
                this._isIconOver = true;
            }
            return;
        }// end function

        private function PlayerIconMouserOut(event:MouseEvent) : void
        {
            this._isIconOver = false;
            return;
        }// end function

        private function getPlayerDataEventHandler(param1:uint) : Function
        {
            var self:Toolbar;
            var index:* = param1;
            self;
            var func:* = function (event:MouseEvent) : void
            {
                var _loc_2:* = self;
                _loc_2.self["_on" + _PlayerDatalist[index]]();
                return;
            }// end function
            ;
            return func;
        }// end function

        public function loadPlayerAvatar(param1:String) : void
        {
            var _loc_2:* = new Image(param1);
            this._PlayerData._PlayerAvatar.addChild(_loc_2);
            return;
        }// end function

        public function set vipLevel(param1:int) : void
        {
            this._PlayerData._VipLevel.visible = param1 > 0;
            this._PlayerData._VipLevel.gotoAndStop(param1);
            return;
        }// end function

        public function set rechargeVisible(param1:Boolean) : void
        {
            this._PlayerData._Recharge.visible = param1;
            return;
        }// end function

        public function set onOpenRune(param1:Function) : void
        {
            this._onOpenRune = param1;
            return;
        }// end function

        public function set runeVisible(param1:Boolean) : void
        {
            this._PlayerData._Rune.visible = param1;
            return;
        }// end function

        private function runes() : void
        {
            this._PlayerData._Rune.addEventListener(MouseEvent.CLICK, this.onRuneClick);
            return;
        }// end function

        private function onRuneClick(event:MouseEvent) : void
        {
            this._onOpenRune();
            return;
        }// end function

        private function buff() : void
        {
            this._buff = new Buff();
            addChild(this._buff);
            this._buff.tip = this._tip;
            this._buff.onDoubleRemoveBuff = function (param1:String) : void
            {
                _onDoubleRemoveBuff(param1);
                return;
            }// end function
            ;
            return;
        }// end function

        public function set onDoubleRemoveBuff(param1:Function) : void
        {
            this._onDoubleRemoveBuff = param1;
            return;
        }// end function

        public function set addBuff(param1:Object) : void
        {
            this._buff.addBuff = param1;
            return;
        }// end function

        public function set visibleBuff(param1:Boolean) : void
        {
            this._buff.visibleBuff = param1;
            return;
        }// end function

        public function set removeBuff(param1:String) : void
        {
            this._buff.removeBuff = param1;
            return;
        }// end function

        public function renderFunctionLink(param1:Object) : void
        {
            var _loc_2:FunctionLinkLabel = null;
            if (this._objFunctionLink.hasOwnProperty(param1["sign"]))
            {
                _loc_2 = this._objFunctionLink[param1["sign"]] as FunctionLinkLabel;
                if (param1["stopText"] == "")
                {
                    _loc_2._TextBtn.removeEventListener(MouseEvent.CLICK, this.linkTextBtnClickHandler);
                    _loc_2._Btn.removeEventListener(MouseEvent.CLICK, this.linkBtnClickHandler);
                    this._tip.removeTarget(_loc_2._TextBtn);
                    this._tip.removeTarget(_loc_2._Btn);
                    if (this._FunctionLink.contains(_loc_2))
                    {
                        this._FunctionLink.removeChild(_loc_2);
                    }
                    _loc_2 = null;
                    delete this._objFunctionLink[param1["sign"]];
                    return;
                }
            }
            else
            {
                if (param1["stopText"] == "")
                {
                    return;
                }
                _loc_2 = new FunctionLinkLabel();
                _loc_2._Text.autoSize = TextFieldAutoSize.LEFT;
                _loc_2._Text.filters = [Filter.stroke];
                _loc_2._Text.setTextFormat(new TextFormat(""));
                _loc_2._TextBtn.addEventListener(MouseEvent.CLICK, this.linkTextBtnClickHandler);
                _loc_2._Btn.addEventListener(MouseEvent.CLICK, this.linkBtnClickHandler);
                _loc_2.y = this._intLinkY;
                this._FunctionLink.addChildAt(_loc_2, 0);
                this._intLinkY = this._intLinkY + 20;
            }
            if (param1["timeText"] == "")
            {
                _loc_2._Text.htmlText = param1["stopText"];
                _loc_2._Btn.visible = false;
            }
            else
            {
                _loc_2._Text.htmlText = param1["runText"] + param1["timeText"];
                _loc_2._Btn.x = _loc_2._Text.x + _loc_2._Text.width + 4;
                _loc_2._Btn.visible = true;
            }
            _loc_2._TextBtn.width = _loc_2._Text.width;
            _loc_2["sign"] = param1["sign"];
            _loc_2["index"] = param1["index"];
            _loc_2["time"] = param1["time"];
            this._objFunctionLink[param1["sign"]] = _loc_2;
            return;
        }// end function

        public function renderFunctionLinkBtnTip(param1:String, param2:String) : void
        {
            var _loc_3:* = this._objFunctionLink[param1] as FunctionLinkLabel;
            if (_loc_3 == null)
            {
                return;
            }
            this._tip.addTarget(_loc_3._Btn, param2);
            return;
        }// end function

        public function renderFunctionTextTip(param1:String, param2:String) : void
        {
            var _loc_3:* = this._objFunctionLink[param1] as FunctionLinkLabel;
            if (_loc_3 == null)
            {
                return;
            }
            this._tip.addTarget(_loc_3._TextBtn, param2);
            return;
        }// end function

        public function setFunctionLinkPoint() : void
        {
            var _loc_1:FunctionLinkLabel = null;
            var _loc_3:int = 0;
            var _loc_4:int = 0;
            this._intLinkY = 0;
            var _loc_2:Array = [];
            for each (_loc_1 in this._objFunctionLink)
            {
                
                _loc_2.push(_loc_1);
            }
            _loc_2.sort(this.sortByFunctionLink);
            _loc_3 = 0;
            _loc_4 = 0;
            for each (_loc_1 in _loc_2)
            {
                
                _loc_1.y = this._intLinkY;
                this._intLinkY = this._intLinkY + 20;
                this._FunctionLink.setChildIndex(_loc_1, _loc_3++);
            }
            return;
        }// end function

        private function sortByFunctionLink(param1:Object, param2:Object) : int
        {
            if (param1["index"] < param2["index"])
            {
                return -1;
            }
            if (param1["index"] > param2["index"])
            {
                return 1;
            }
            if (param1["time"] < param2["time"])
            {
                return 1;
            }
            if (param1["time"] > param2["time"])
            {
                return -1;
            }
            return 0;
        }// end function

        private function linkTextBtnClickHandler(event:MouseEvent) : void
        {
            var _loc_2:* = event.target as SimpleButton;
            var _loc_3:* = _loc_2.parent as FunctionLinkLabel;
            this._onLinkTextClick(_loc_3["sign"]);
            return;
        }// end function

        private function linkBtnClickHandler(event:MouseEvent) : void
        {
            var _loc_2:* = event.target as SimpleButton;
            var _loc_3:* = _loc_2.parent as FunctionLinkLabel;
            this._onLinkBtnClick(_loc_3["sign"]);
            return;
        }// end function

        public function clearFunctionLink() : void
        {
            var _loc_1:FunctionLinkLabel = null;
            for each (_loc_1 in this._objFunctionLink)
            {
                
                _loc_1._TextBtn.removeEventListener(MouseEvent.CLICK, this.linkTextBtnClickHandler);
                _loc_1._Btn.removeEventListener(MouseEvent.CLICK, this.linkBtnClickHandler);
                this._tip.removeTarget(_loc_1._TextBtn);
                this._tip.removeTarget(_loc_1._Btn);
                if (this._FunctionLink.contains(_loc_1))
                {
                    this._FunctionLink.removeChild(_loc_1);
                }
            }
            this._objFunctionLink = {};
            this._intLinkY = 0;
            return;
        }// end function

        public function removeFunctionLink(param1:String) : void
        {
            var _loc_2:FunctionLinkLabel = null;
            for each (_loc_2 in this._objFunctionLink)
            {
                
                if (_loc_2["sign"] == param1)
                {
                    _loc_2._TextBtn.removeEventListener(MouseEvent.CLICK, this.linkTextBtnClickHandler);
                    _loc_2._Btn.removeEventListener(MouseEvent.CLICK, this.linkBtnClickHandler);
                    this._tip.removeTarget(_loc_2._TextBtn);
                    this._tip.removeTarget(_loc_2._Btn);
                    if (this._FunctionLink.contains(_loc_2))
                    {
                        this._FunctionLink.removeChild(_loc_2);
                    }
                    delete this._objFunctionLink[param1];
                }
            }
            this.setFunctionLinkPoint();
            return;
        }// end function

        public function set onLinkTextClick(param1:Function) : void
        {
            this._onLinkTextClick = param1;
            return;
        }// end function

        public function set onLinkBtnClick(param1:Function) : void
        {
            this._onLinkBtnClick = param1;
            return;
        }// end function

        public function set onQuest(param1:Function) : void
        {
            this._onQuest = param1;
            return;
        }// end function

        public function set questTraceLink(param1:Function) : void
        {
            this._questTraceLink = param1;
            return;
        }// end function

        public function set questTraceTipVisible(param1:Boolean) : void
        {
            if (param1)
            {
                this._tip.addTarget(this._QuestTrace._Trace, ToolbarLang.QuestTrace);
            }
            else
            {
                this._tip.removeTarget(this._QuestTrace._Trace);
            }
            return;
        }// end function

        private function questTrace() : void
        {
            this._questScrollBar = this._QuestTrace._ScrollBar;
            this._questScrollBar.visible = false;
            this._QuestTrace._Accepted.buttonMode = true;
            this._QuestTrace._Accepted.useHandCursor = true;
            this._QuestTrace._Acceptable.buttonMode = true;
            this._QuestTrace._Acceptable.useHandCursor = true;
            this._QuestTrace._Expand.buttonMode = true;
            this._QuestTrace._Expand.useHandCursor = true;
            this._QuestTrace._Background.alpha = 0;
            this._QuestTrace._Background.height = this._questBackHeight;
            this._QuestTrace._Accepted.gotoAndStop(1);
            this._QuestTrace._Accepted.addEventListener(MouseEvent.CLICK, this.acceptedQuestHandler);
            this._QuestTrace._Acceptable.addEventListener(MouseEvent.CLICK, this.acceptableQuestHandler);
            this._QuestTrace._Quest.addEventListener(MouseEvent.CLICK, this.questClick);
            this._QuestTrace._Expand.addEventListener(MouseEvent.CLICK, this.expandQuestHandler);
            this._QuestTrace._Trace.filters = [Filter.stroke];
            this._QuestTrace._Trace.autoSize = TextFieldAutoSize.LEFT;
            this._QuestTrace._Trace.addEventListener(TextEvent.LINK, this.traceLinkHandler);
            this._QuestTrace.addEventListener(MouseEvent.MOUSE_OVER, this.questBackOver);
            this._QuestTrace.addEventListener(MouseEvent.MOUSE_OUT, this.questBackOut);
            this.questTraceTipVisible = true;
            return;
        }// end function

        private function addScrollBarHandler() : void
        {
            this._questScrollBar.addEventListener(ScrollEvent.SCROLL, this.questScrollBarHandler);
            return;
        }// end function

        private function removeScrollBarHandler() : void
        {
            this._questScrollBar.removeEventListener(ScrollEvent.SCROLL, this.questScrollBarHandler);
            return;
        }// end function

        private function questScrollBarHandler(event:ScrollEvent) : void
        {
            this._scrollVs[this._tabType] = this._QuestTrace._Trace.scrollV;
            return;
        }// end function

        public function renderQuestTrace(param1:Object) : void
        {
            this._questTraceData = param1;
            if (this.questTraceVisible == false)
            {
                return;
            }
            if (this._questTraceData["accepted"].length > 0)
            {
                this._tabType = "accepted";
                this.questTraceVisible = true;
                this.acceptedQuestHandler(null);
            }
            else if (this._questTraceData["acceptable"].length > 0)
            {
                this._tabType = "acceptable";
                this.questTraceVisible = true;
                this.acceptableQuestHandler(null);
            }
            else
            {
                this.acceptedQuestHandler(null);
                this._QuestTrace._Trace.visible = false;
                this.questTraceVisible = false;
            }
            this._questScrollBar.visible = false;
            return;
        }// end function

        private function questClick(event:MouseEvent) : void
        {
            this._onQuest();
            return;
        }// end function

        private function acceptedQuestHandler(event:MouseEvent) : void
        {
            this.removeScrollBarHandler();
            if (event != null)
            {
                if (this._tabType == "accepted")
                {
                    return;
                }
                if (this._tabType == "acceptable")
                {
                    this._scrollVs[this._tabType] = this._QuestTrace._Trace.scrollV;
                }
                this._expand = true;
                this._tabType = "accepted";
                this.expandQuest();
            }
            this._QuestTrace._Accepted.gotoAndStop(1);
            this._QuestTrace._Acceptable.gotoAndStop(2);
            this.switchQuestTrace(this._tabType);
            this.addScrollBarHandler();
            return;
        }// end function

        private function acceptableQuestHandler(event:MouseEvent) : void
        {
            this.removeScrollBarHandler();
            if (event != null)
            {
                if (this._tabType == "acceptable")
                {
                    return;
                }
                if (this._tabType == "accepted")
                {
                    this._scrollVs[this._tabType] = this._QuestTrace._Trace.scrollV;
                }
                this._expand = true;
                this._tabType = "acceptable";
                this.expandQuest();
            }
            this._QuestTrace._Accepted.gotoAndStop(2);
            this._QuestTrace._Acceptable.gotoAndStop(1);
            this.switchQuestTrace(this._tabType);
            this.addScrollBarHandler();
            return;
        }// end function

        private function switchQuestTrace(param1:String) : void
        {
            var _loc_2:Array = [];
            var _loc_3:* = this._questTraceData[param1];
            var _loc_4:* = _loc_3.length;
            this._questLines = [];
            var _loc_5:int = 0;
            while (_loc_5 < _loc_4)
            {
                
                this._questLines.push(/<br>""<br>/.test(_loc_3[_loc_5]) ? (2) : (1));
                _loc_2.push(_loc_3[_loc_5]);
                _loc_5 = _loc_5 + 1;
            }
            this._QuestTrace._Trace.htmlText = _loc_2.join("<br>");
            this._QuestTrace._Trace.visible = true;
            this.updateQuestScrollBar();
            this._questScrollBar.scrollTargetName = "_Trace";
            this._QuestTrace._Trace.scrollV = this._scrollVs[this._tabType];
            return;
        }// end function

        private function get questLine() : int
        {
            var _loc_2:Object = null;
            var _loc_1:int = 0;
            for (_loc_2 in this._questLines)
            {
                
                _loc_1 = _loc_1 + this._questLines[_loc_2];
            }
            return _loc_1;
        }// end function

        private function expandQuestHandler(event:MouseEvent) : void
        {
            this._expand = !this._expand;
            this.expandQuest();
            return;
        }// end function

        private function expandQuest() : void
        {
            this._QuestTrace._Expand.gotoAndStop(this._expand ? (1) : (2));
            this._QuestTrace._Trace.visible = this._expand;
            if (this._expand)
            {
                this.updateQuestScrollBar();
            }
            else
            {
                this._questScrollBar.visible = false;
                this.updateQuestHeight(this._questBackHeight);
            }
            this._QuestTrace._Trace.scrollV = this._scrollVs[this._tabType];
            return;
        }// end function

        private function traceLinkHandler(event:TextEvent) : void
        {
            this._questTraceLink(event.text);
            return;
        }// end function

        private function questBackOver(event:MouseEvent) : void
        {
            this._QuestTrace._Background.alpha = 1;
            if (this._expand)
            {
                this._questScrollBar.visible = this._hasQuestScrollBar;
            }
            return;
        }// end function

        private function questBackOut(event:MouseEvent) : void
        {
            this._QuestTrace._Background.alpha = 0;
            this._questScrollBar.visible = false;
            return;
        }// end function

        private function updateQuestStatus() : void
        {
            if (this.questLine > 0)
            {
                this._QuestTrace._Trace.visible = true;
                this.updateQuestHeight(this._questBackHeight + this._QuestTrace._Trace.height + this._questAddonHeight);
            }
            else
            {
                this._QuestTrace._Trace.visible = false;
                this.updateQuestHeight(this._questBackHeight);
            }
            return;
        }// end function

        private function updateQuestScrollBar() : void
        {
            var _loc_1:Number = NaN;
            var _loc_2:String = null;
            var _loc_3:Boolean = false;
            this._QuestTrace._Trace.autoSize = TextFieldAutoSize.LEFT;
            if (this.questLine > this._maxQuestLine)
            {
                _loc_1 = this._QuestTrace._Trace.height / this.questLine * this._maxQuestLine;
                _loc_3 = true;
                _loc_2 = TextFieldAutoSize.NONE;
            }
            else
            {
                _loc_1 = this.questLine > 0 ? (this._QuestTrace._Trace.height) : (0);
                _loc_3 = false;
                _loc_2 = TextFieldAutoSize.LEFT;
            }
            this._hasQuestScrollBar = _loc_3;
            this._QuestTrace._Trace.autoSize = _loc_2;
            this._QuestTrace._Trace.height = _loc_1;
            this._questScrollBar.visible = _loc_3;
            this._questScrollBar.height = _loc_1;
            this.updateQuestHeight(this._questBackHeight + _loc_1 + (_loc_1 > 0 ? (this._questAddonHeight) : (0)));
            return;
        }// end function

        private function updateQuestHeight(param1:Number) : void
        {
            this._QuestTrace._Background.height = param1;
            return;
        }// end function

        public function newFunctionBar(param1:Array, param2:Array) : void
        {
            this._FunctionBar.show(param1, param2);
            return;
        }// end function

        public function getFunctionPoint(param1:String) : Point
        {
            var _loc_2:* = this._FunctionBar.getPointByType(param1);
            return _loc_2;
        }// end function

        public function set onEnd(param1:Function) : void
        {
            this._onEnd = param1;
            return;
        }// end function

        private function functionBar() : void
        {
            var btnName:String;
            var w:Number;
            var r:Number;
            this._FunctionBar._FriendMessage.visible = false;
            var l:* = FunctionType.FullList;
            var len:* = l.length;
            var i:uint;
            while (i < len)
            {
                
                btnName = "_" + l[i];
                if (!this._FunctionBar[btnName])
                {
                }
                else
                {
                    if (i == (len - 1))
                    {
                        r = this._FunctionBar[btnName].x;
                        w = this._FunctionBar[btnName].width;
                    }
                    this._FunctionBar[btnName].visible = false;
                    this._FunctionBar[btnName].addEventListener(MouseEvent.CLICK, this.getFunctionBarEventHandler(i, l));
                }
                i = (i + 1);
            }
            this._tip.addTarget(this._FunctionBar._Body, ToolbarLang.Body + "[C]");
            this._tip.addTarget(this._FunctionBar._Pack, ToolbarLang.Pack + "[B]");
            this._tip.addTarget(this._FunctionBar._Upgrade, ToolbarLang.Upgrade + "[F]");
            this._tip.addTarget(this._FunctionBar._Deploy, ToolbarLang.Deploy + "[E]");
            this._tip.addTarget(this._FunctionBar._Research, ToolbarLang.Research + "[T]");
            this._tip.addTarget(this._FunctionBar._Fate, ToolbarLang.Fate + "[X]");
            this._tip.addTarget(this._FunctionBar._StudyStunt, ToolbarLang.StudyStunt + "[H]");
            this._tip.addTarget(this._FunctionBar._SealSoul, ToolbarLang.SealSoul + "[Y]");
            this._tip.addTarget(this._FunctionBar._Achievement, ToolbarLang.Achievement + "[P]");
            this._tip.addTarget(this._FunctionBar._Friend, ToolbarLang.Friend + "[V]");
            this._tip.addTarget(this._FunctionBar._Faction, ToolbarLang.Faction + "[G]");
            this._tip.addTarget(this._FunctionBar._Practice, ToolbarLang.Practice + "[Z]");
            this._tip.addTarget(this._FunctionBar._ExperienceBtn, ToolbarLang.Experience);
            this._FunctionBar.onEnd = function () : void
            {
                _onEnd();
                return;
            }// end function
            ;
            return;
        }// end function

        private function getFunctionBarEventHandler(param1:uint, param2:Array) : Function
        {
            var self:Toolbar;
            var index:* = param1;
            var l:* = param2;
            self;
            var func:* = function (event:MouseEvent) : void
            {
                var _loc_2:* = self;
                _loc_2.self["_on" + l[index]]();
                return;
            }// end function
            ;
            return func;
        }// end function

        public function set onBody(param1:Function) : void
        {
            this._onBody = param1;
            return;
        }// end function

        public function set onPack(param1:Function) : void
        {
            this._onPack = param1;
            return;
        }// end function

        public function set onUpgrade(param1:Function) : void
        {
            this._onUpgrade = param1;
            return;
        }// end function

        public function set onDeploy(param1:Function) : void
        {
            this._onDeploy = param1;
            return;
        }// end function

        public function set onResearch(param1:Function) : void
        {
            this._onResearch = param1;
            return;
        }// end function

        public function set onFate(param1:Function) : void
        {
            this._onFate = param1;
            return;
        }// end function

        public function set onSealSoul(param1:Function) : void
        {
            this._onSealSoul = param1;
            return;
        }// end function

        public function set onPetAnimal(param1:Function) : void
        {
            this._onPetAnimal = param1;
            return;
        }// end function

        public function set onFriend(param1:Function) : void
        {
            this._onFriend = param1;
            return;
        }// end function

        public function set onFaction(param1:Function) : void
        {
            this._onFaction = param1;
            return;
        }// end function

        public function set onStudyStunt(param1:Function) : void
        {
            this._onStudyStunt = param1;
            return;
        }// end function

        public function set onPractice(param1:Function) : void
        {
            this._onPractice = param1;
            return;
        }// end function

        public function updateExperience(param1:Number, param2:Number) : void
        {
            this._FunctionBar._ExpLeft.visible = param1 > 0;
            this._FunctionBar._ExpMiddle.visible = param1 > 0;
            this._FunctionBar._ExpRight.visible = param1 > 0;
            this._FunctionBar._Experience.htmlText = ["", param1, "/", param2, " (", Math.floor(1000 * param1 / param2) / 10, "%)"].join("");
            this.formatTextFormat(this._FunctionBar._Experience, true);
            if (param1 == 0)
            {
                return;
            }
            var _loc_3:Number = 668;
            _loc_3 = _loc_3 - (this._FunctionBar._ExpLeft.width - this._FunctionBar._ExpRight.width);
            this._FunctionBar._ExpMiddle.width = param1 / param2 * _loc_3;
            this._FunctionBar._ExpRight.x = this._FunctionBar._ExpMiddle.x + this._FunctionBar._ExpMiddle.width;
            return;
        }// end function

        public function switchBubble(param1:int) : void
        {
            this._messageCount = param1;
            if (param1 > 0)
            {
                if (FunctionType.isOpened(FunctionType.Friend))
                {
                    if (this._isFriendMessage == false)
                    {
                        this._FunctionBar.addChild(this._FunctionBar._FriendMessage);
                        this._FunctionBar._FriendMessage.x = this._FunctionBar._Friend.x - this._FunctionBar._FriendMessage.width / 2;
                        this._isFriendMessage = true;
                    }
                    this._FunctionBar._FriendMessage.visible = true;
                }
            }
            else
            {
                if (this._FunctionBar._FriendMessage.parent)
                {
                }
                if (this._isFriendMessage)
                {
                    this._FunctionBar._FriendMessage.parent.removeChild(this._FunctionBar._FriendMessage);
                    this._isFriendMessage = false;
                }
            }
            return;
        }// end function

        public function set functionBarParent(param1:Sprite) : void
        {
            if (!param1)
            {
            }
            this.addChild(this._FunctionBar);
            return;
        }// end function

        private function showBarInfo() : void
        {
            var _loc_4:TextField = null;
            var _loc_5:SimpleButton = null;
            var _loc_6:String = null;
            var _loc_1:Array = [[this._PlayerData._Health, this._PlayerData._HealthBtn, "Health"], [this._PlayerData._Power, this._PlayerData._PowerBtn, "Power"], [this._FunctionBar._Experience, this._FunctionBar._ExperienceBtn, "Exp"]];
            var _loc_2:* = _loc_1.length;
            var _loc_3:uint = 0;
            while (_loc_3 < _loc_2)
            {
                
                _loc_4 = _loc_1[_loc_3][0];
                _loc_5 = _loc_1[_loc_3][1];
                _loc_6 = _loc_1[_loc_3][2];
                _loc_4.visible = false;
                _loc_5.addEventListener(MouseEvent.MOUSE_OVER, this.infoHandler(_loc_4, _loc_6, true));
                _loc_5.addEventListener(MouseEvent.MOUSE_OUT, this.infoHandler(_loc_4, _loc_6, false));
                _loc_3 = _loc_3 + 1;
            }
            return;
        }// end function

        private function infoHandler(param1:TextField, param2:String, param3:Boolean) : Function
        {
            var mc:* = param1;
            var sign:* = param2;
            var visible:* = param3;
            var func:* = function (event:MouseEvent) : void
            {
                mc.visible = visible;
                return;
            }// end function
            ;
            return func;
        }// end function

        public function showExpFile(param1:Boolean) : void
        {
            this._showExpFile = param1;
            this._FunctionBar._Experience.visible = param1;
            return;
        }// end function

        public function addPackFull() : void
        {
            this._FunctionBar.addPackFull();
            return;
        }// end function

        public function removePackFull() : void
        {
            this._FunctionBar.removePackFull();
            return;
        }// end function

        public function updatePackMessageXY() : void
        {
            this._FunctionBar.updatePackMessageXY();
            return;
        }// end function

        private function clickIgnore() : void
        {
            return;
        }// end function

        private function clickIgnoreHandler(event:MouseEvent) : void
        {
            if (this._onClickIgnore is Function)
            {
                this._onClickIgnore(event);
            }
            return;
        }// end function

        public function playFlowerRain(param1:String, param2:int, param3:int) : void
        {
            var intCompleteCount:int;
            var img:Image;
            var url:* = param1;
            var intHeight:* = param2;
            var intWidth:* = param3;
            this._intFlowerRainHeight = intHeight;
            this._intFlowerRainWidth = intWidth;
            intCompleteCount;
            var i:int;
            while (i <= this._aryFlowerCount.length)
            {
                
                img = new Image(url + i + ".png");
                img.onComplete = function () : void
            {
                var _loc_2:* = intCompleteCount + 1;
                intCompleteCount = _loc_2;
                if (intCompleteCount == _aryFlowerCount.length)
                {
                    initFlowerRainCartoon(url);
                }
                return;
            }// end function
            ;
                i = (i + 1);
            }
            return;
        }// end function

        private function initFlowerRainCartoon(param1:String) : void
        {
            var _loc_3:int = 0;
            var _loc_4:Image = null;
            var _loc_5:Object = null;
            if (this._blnInFlowerRainPlay)
            {
                return;
            }
            this._blnInFlowerRainPlay = true;
            var _loc_2:int = 1;
            while (_loc_2 <= this._aryFlowerCount.length)
            {
                
                _loc_3 = 0;
                while (_loc_3 < this._aryFlowerCount[(_loc_2 - 1)])
                {
                    
                    _loc_4 = new Image(param1 + _loc_2 + ".png");
                    _loc_4.x = Math.random() * this._intFlowerRainWidth;
                    _loc_4.y = Math.random() * this._intFlowerRainHeight * -2;
                    _loc_5 = {img:_loc_4, move:Math.ceil(Math.random() * 10) > 5 ? (1) : (-1), oredr:Math.ceil(Math.random() * 1000)};
                    this._aryFlowerImg.push(_loc_5);
                    _loc_3 = _loc_3 + 1;
                }
                _loc_2 = _loc_2 + 1;
            }
            this._aryFlowerImg.sortOn("order", Array.NUMERIC);
            this.addEventListener(Event.ENTER_FRAME, this.onFlowerRainPlay);
            return;
        }// end function

        private function onFlowerRainPlay(event:Event) : void
        {
            var _loc_3:Object = null;
            var _loc_4:Image = null;
            var _loc_5:Number = NaN;
            var _loc_2:Boolean = true;
            for each (_loc_3 in this._aryFlowerImg)
            {
                
                _loc_4 = _loc_3["img"] as Image;
                _loc_5 = _loc_3["move"];
                if (_loc_4.y > -50)
                {
                }
                if (_loc_4.y - 50 < this._intFlowerRainHeight)
                {
                }
                if (!this.contains(_loc_4))
                {
                    this.addChild(_loc_4);
                }
                if (_loc_4.y - 50 < this._intFlowerRainHeight)
                {
                    _loc_4.x = _loc_4.x + _loc_5;
                    _loc_4.y = _loc_4.y + 6;
                    _loc_2 = false;
                    continue;
                }
                if (this.contains(_loc_4))
                {
                    this.removeChild(_loc_4);
                }
            }
            if (_loc_2)
            {
                this.removeEventListener(Event.ENTER_FRAME, this.onFlowerRainPlay);
                this._aryFlowerImg = [];
                this._blnInFlowerRainPlay = false;
            }
            return;
        }// end function

        public function reposition(param1:int, param2:int, param3:int, param4:int, param5:Point) : void
        {
            param3 = Math.min(param3, stage.stageWidth);
            param4 = Math.min(param4, stage.stageHeight);
            this._MiniMap.x = Math.max(this._miniMapXY[0] - param5.x, param3 - (param1 - this._miniMapXY[0]));
            this._QuestTrace.x = Math.max(this._questTraceXY[0] - param5.x, param3 - (param1 - this._questTraceXY[0]));
            this._FunctionBar.x = Math.max(this._functionBarXY[0] - param5.x, param3 - (param1 - this._functionBarXY[0]));
            this._FunctionBar.y = Math.max(this._functionBarXY[1] - param5.y, param4 - (param2 - this._functionBarXY[1]));
            this.switchBubble(this._messageCount);
            return;
        }// end function

        public function get content() : Sprite
        {
            return this;
        }// end function

        public function set tip(param1:ITip) : void
        {
            this._tip = param1;
            return;
        }// end function

        public function set alert(param1:IAlert) : void
        {
            this._alert = param1;
            return;
        }// end function

        public function set goodsIconUrl(param1:String) : void
        {
            this._goodsIconUrl = param1;
            return;
        }// end function

        public function set addonsUrl(param1:String) : void
        {
            this._addonsUrl = param1;
            return;
        }// end function

        public function get addonsUrl() : String
        {
            return this._addonsUrl;
        }// end function

        public function set playerDataVisible(param1:Boolean) : void
        {
            this._PlayerData.visible = param1;
            return;
        }// end function

        public function get playerDataVisible() : Boolean
        {
            return this._PlayerData.visible;
        }// end function

        public function set functionLinkVisible(param1:Boolean) : void
        {
            this._FunctionLink.visible = param1;
            return;
        }// end function

        public function get functionLinkVisible() : Boolean
        {
            return this._FunctionLink.visible;
        }// end function

        public function get questTraceVisible() : Boolean
        {
            return this._QuestTrace.visible;
        }// end function

        public function set questTraceVisible(param1:Boolean) : void
        {
            this._QuestTrace.visible = param1;
            return;
        }// end function

        public function set functionBarVisible(param1:Boolean) : void
        {
            this._FunctionBar.visible = param1;
            return;
        }// end function

        public function get functionBarVisible() : Boolean
        {
            return this._FunctionBar.visible;
        }// end function

        public function get miniMap() : IMiniMap
        {
            return this._MiniMap;
        }// end function

        public function get questTraceContent() : Sprite
        {
            return this._QuestTrace;
        }// end function

        public function set onClickIgnore(param1:Function) : void
        {
            this._onClickIgnore = param1;
            return;
        }// end function

    }
}
